import { UopPaymentTypeEnum } from '@/enums';
import { Transform } from 'class-transformer';
import { IsDefined, Max, Min } from 'class-validator';

export class WalletRechangeDto {
  @IsDefined({ message: '充值方式必填' })
  @Transform(({ value }) => Number(value))
  type: UopPaymentTypeEnum;

  @IsDefined({ message: '充值金额必填' })
  @Transform(({ value }) => Number(value))
  @Min(1, { message: '充值金额不能小于1元' })
  @Max(500000, { message: '单笔充值金额不能大于50万元' })
  amount: number;

  ip?: string;
}

export class WalletWithdrawDto {
  @IsDefined({ message: '密码必填' })
  pass: string;

  @IsDefined({ message: '提现银行卡必填' })
  bankId: number;

  @IsDefined({ message: '提现金额必填' })
  @Transform(({ value }) => Number(value))
  @Min(10, { message: '单笔提现金额不能小于10元' })
  @Max(50000, { message: '单笔提现金额不能大于5万元' })
  amount: number;
}
